from cryptography.fernet import Fernet

def encrypt_data(data):
    """
    加密数据
    :param data: 原始数据
    :return: 加密后的数据
    """
    key = Fernet.generate_key()
    cipher_suite = Fernet(key)
    encrypted_data = cipher_suite.encrypt(data)
    return encrypted_data, key

# 示例
data = b"Sensitive data"
encrypted_data, key = encrypt_data(data)
print(f"Encrypted data: {encrypted_data}")